﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CharParameters : MonoBehaviour
{
    [SerializeField]
    private MainStat mainStat;

    [SerializeField]
    public GameObject plusButton;
    [SerializeField]
    private Text textField;
    [SerializeField]
    private Passive[] passives;
    [SerializeField]
    private int count;

    public int MyCount { get => count; set => count = value; }

    // Start is called before the first frame update
    void Start()
    {
        UpdateTextField();
        mainStat.MainStatUpdateTxt();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void Lock()
    {
        plusButton.SetActive(false);
    }
    public void Unlock()
    {
        plusButton.SetActive(true);
    }
    public void Click()
    {
        MyCount++;
       
        UpdateTextField();
        mainStat.MyStatCount++;
        mainStat.MainStatUpdateTxt();
    }
    private void UpdateTextField()
    {
        textField.text = MyCount.ToString();
        foreach (Passive pass in passives)
        {
            pass.Calculate(MyCount);
        }
    }
}
